<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>按键统计精灵</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    html, body {
      width: 760px;
      height: 440px;
      overflow: hidden;
    }

    body {
      padding: 10px;
      font-family: "PingFang SC", "Microsoft YaHei", "微软雅黑", sans-serif;
      background-color: #f0f7f4;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
    }

    /* Header total area */
    .header {
      background: linear-gradient(135deg, #2ecc71, #27ae60);
      color: white;
      padding: 10px 20px;
      border-radius: 10px;
      text-align: center;
      box-shadow: 0 4px 15px rgba(46, 204, 113, 0.2);
      width: 95%;
    }

    .total-count {
      font-size: 20px;
      font-weight: bold;
      margin: 0;
    }

    /* Keyboard layout area */
    .keyboard-layout {
      background: white;
      padding: 12px;
      border-radius: 10px;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
      width: 95%;
      display: flex;
      flex-direction: column;
      gap: 5px;
    }

    .keyboard-row {
      display: flex;
      justify-content: center;
      gap: 5px;
    }

    .key {
      background: #ffffff;
      border: 2px solid #a8e6cf;
      border-radius: 6px;
      padding: 5px;
      min-width: 40px;
      height: 52px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      cursor: default;
      transition: all 0.3s ease;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .key:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
      border-color: #2ecc71;
    }

    .key-name {
      font-size: 12px;
      font-weight: bold;
      color: #2c3e50;
    }

    .key-count {
      font-size: 11px;
      color: #27ae60;
      font-weight: bold;
    }

    /* Special keys style */
    .key.special {
      background: #f8f9fa;
      min-width: 55px;
      border-color: #a8e6cf;
    }

    .key.space {
      min-width: 200px;
    }

    .key.arrow {
      min-width: 45px;
      font-size: 14px;
    }

    /* Reset button */
    .reset-btn {
      background: #2ecc71;
      color: white;
      border: none;
      padding: 8px 25px;
      border-radius: 18px;
      font-size: 14px;
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 4px 15px rgba(46, 204, 113, 0.2);
      margin-top: 5px;
    }

    .reset-btn:hover {
      background: #27ae60;
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(46, 204, 113, 0.3);
    }
  </style>
</head>
<body>
  <div class="header">
    <h2 class="total-count">总共按键次数: <span id="totalCount">0</span></h2>
  </div>

  <div class="keyboard-layout">
    <div class="keyboard-row">
      <div class="key special"><div class="key-name">ESC</div><div class="key-count" data-key="Escape">0</div></div>
      <div class="key"><div class="key-name">1</div><div class="key-count" data-key="1">0</div></div>
      <div class="key"><div class="key-name">2</div><div class="key-count" data-key="2">0</div></div>
      <div class="key"><div class="key-name">3</div><div class="key-count" data-key="3">0</div></div>
      <div class="key"><div class="key-name">4</div><div class="key-count" data-key="4">0</div></div>
      <div class="key"><div class="key-name">5</div><div class="key-count" data-key="5">0</div></div>
      <div class="key"><div class="key-name">6</div><div class="key-count" data-key="6">0</div></div>
      <div class="key"><div class="key-name">7</div><div class="key-count" data-key="7">0</div></div>
      <div class="key"><div class="key-name">8</div><div class="key-count" data-key="8">0</div></div>
      <div class="key"><div class="key-name">9</div><div class="key-count" data-key="9">0</div></div>
      <div class="key"><div class="key-name">0</div><div class="key-count" data-key="0">0</div></div>
    </div>

    <div class="keyboard-row">
      <div class="key"><div class="key-name">Q</div><div class="key-count" data-key="q">0</div></div>
      <div class="key"><div class="key-name">W</div><div class="key-count" data-key="w">0</div></div>
      <div class="key"><div class="key-name">E</div><div class="key-count" data-key="e">0</div></div>
      <div class="key"><div class="key-name">R</div><div class="key-count" data-key="r">0</div></div>
      <div class="key"><div class="key-name">T</div><div class="key-count" data-key="t">0</div></div>
      <div class="key"><div class="key-name">Y</div><div class="key-count" data-key="y">0</div></div>
      <div class="key"><div class="key-name">U</div><div class="key-count" data-key="u">0</div></div>
      <div class="key"><div class="key-name">I</div><div class="key-count" data-key="i">0</div></div>
      <div class="key"><div class="key-name">O</div><div class="key-count" data-key="o">0</div></div>
      <div class="key"><div class="key-name">P</div><div class="key-count" data-key="p">0</div></div>
    </div>

    <div class="keyboard-row">
      <div class="key"><div class="key-name">A</div><div class="key-count" data-key="a">0</div></div>
      <div class="key"><div class="key-name">S</div><div class="key-count" data-key="s">0</div></div>
      <div class="key"><div class="key-name">D</div><div class="key-count" data-key="d">0</div></div>
      <div class="key"><div class="key-name">F</div><div class="key-count" data-key="f">0</div></div>
      <div class="key"><div class="key-name">G</div><div class="key-count" data-key="g">0</div></div>
      <div class="key"><div class="key-name">H</div><div class="key-count" data-key="h">0</div></div>
      <div class="key"><div class="key-name">J</div><div class="key-count" data-key="j">0</div></div>
      <div class="key"><div class="key-name">K</div><div class="key-count" data-key="k">0</div></div>
      <div class="key"><div class="key-name">L</div><div class="key-count" data-key="l">0</div></div>
    </div>

    <div class="keyboard-row">
      <div class="key special"><div class="key-name">SHIFT</div><div class="key-count" data-key="Shift">0</div></div>
      <div class="key"><div class="key-name">Z</div><div class="key-count" data-key="z">0</div></div>
      <div class="key"><div class="key-name">X</div><div class="key-count" data-key="x">0</div></div>
      <div class="key"><div class="key-name">C</div><div class="key-count" data-key="c">0</div></div>
      <div class="key"><div class="key-name">V</div><div class="key-count" data-key="v">0</div></div>
      <div class="key"><div class="key-name">B</div><div class="key-count" data-key="b">0</div></div>
      <div class="key"><div class="key-name">N</div><div class="key-count" data-key="n">0</div></div>
      <div class="key"><div class="key-name">M</div><div class="key-count" data-key="m">0</div></div>
    </div>

    <div class="keyboard-row">
      <div class="key special"><div class="key-name">CTRL</div><div class="key-count" data-key="Control">0</div></div>
      <div class="key special"><div class="key-name">ALT</div><div class="key-count" data-key="Alt">0</div></div>
      <div class="key space"><div class="key-name">空格</div><div class="key-count" data-key="Space">0</div></div>
      <div class="key arrow"><div class="key-name">←</div><div class="key-count" data-key="ArrowLeft">0</div></div>
      <div class="key arrow"><div class="key-name">↑</div><div class="key-count" data-key="ArrowUp">0</div></div>
      <div class="key arrow"><div class="key-name">↓</div><div class="key-count" data-key="ArrowDown">0</div></div>
      <div class="key arrow"><div class="key-name">→</div><div class="key-count" data-key="ArrowRight">0</div></div>
    </div>
  </div>

  <button id="resetBtn" class="reset-btn">重置统计次数</button>

  <script src="popup.js"></script>
</body>
</html>
